<?php

// Convert array to object
	function parseArrayToObject($array) {
   		$object = new stdClass();
   		if (is_array($array) && count($array) > 0) {
      		foreach ($array as $name=>$value) {
         		$name = strtolower(trim($name));
         		if (!empty($name)) {
            		$object->$name = $value;
         		}
      		}
   		}
   		return $object;
   	}
   	
   	// Convert object to array
   	function parseObjectToArray($object) {
	   $array = array();
	   if (is_object($object)) {
	      $array = get_object_vars($object);
	   }
	   return $array;
	}
	
	
	// Visualize a multidimensional array
	function visualizeMultiArray($array)
	{
		echo $array.' = array (';
	    	echo "<br />";
			for ($row = 0; $row < count($array); $row++)
			{
			    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
				echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
				echo 'Row '.$row.' '.'array (';
			
			    foreach($array[$row] as $key => $value)
			    {
			        echo $key.' => '.$value.", ";
			    }
				echo ")<br />";
			}
	}
	
	// Visualize a single dimensional array
	function visualizeSingleArray($array)
	{
		echo (br().$array.br());
		foreach ($array as $k => $v)
		{
			echo ('KEY : '.$k . ' - '. 'VALUE : '.$v.br());
		}
	}
?>